{
  "name"    : "mobileshowcase",

  "include" :
  [
    {
      "path" : "${QOOXDOO_PATH}/tool/data/config/application.json"
    }
  ],

  "export" :
  [
    "api",
    "api-data",
    "build",
    "clean",
    "distclean",
    "fix",
    "info",
    "lint",
    "migration",
    "pretty",
    "profiling",
    "simulation-build",
    "simulation-run",
    "source",
    "source-all",
    "source-hybrid",
    "test",
    "test-source",
    "translation",
    "minify-css",
    "source-ios",
    "source-android",
    "source-indigo",
    "build-ios",
    "build-android",
    "build-indigo"
  ],
  
  "default-job" : "source-hybrid",

  "let" :
  {
    "APPLICATION"  : "mobileshowcase",
    "APPLICATION_CSS" : "${APPLICATION}/css/styles.css",  // resource id of custom css
    "QOOXDOO_PATH" : "../../",
    "LOCALES"      : [ "en" ],
    "CACHE"        : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache",
    "THEME"        : "indigo",  // provide a default
    "CSS_COMB_URI" : "./resource/${APPLICATION}/css/${THEME}-style-min.css",
    "CSS_COMBINED" : "${BUILD_PATH}/${CSS_COMB_URI}",
    "ROOT"         : ".",
    "QXTHEME"      : ""
  },

  "config-warnings" : 
  {
    "job-shadowing" : [
      "source",
      "build",
      "source-all-script", 
      "build-files", 
      "build-script", 
      "source-script"
    ],
    
    "environment" : [ "non-literal-keys" ]
  },

  // You only need to edit the remainder of this file, if you want to customize
  // specific jobs, or add own job definitions.

  "jobs" :
  {
    // Uncomment the following entry to add a contrib or library to your
    // project; make sure to adapt the path to the Manifest.json; if you are
    // using a contrib: library, it will be downloaded into the path specified
    // by the 'cache/downloads' config key
    /*
    , "libraries" : 
    {
      "library" :
      [
        {
          "manifest" : "contrib://SkeletonApplication/trunk/Manifest.json"
        }
      ]
    },
    */

    "mobile-common" :
    {
      "=include" :
      [
        "${APPLICATION}.Application"
      ],
      
      "environment" :
      {
        "qx.version"     : "${APPLICATION}",
        "qx.application" : "${APPLICATION}.Application",
        "qx.mobile.emulatetouch" : true,
        "qx.mobile.nativescroll" : false,
        "qx.theme" : "${THEME}"
      }
    },
    
    "source-ios" :
    {
      "extend" : ["source"],
      "let" : { "THEME" : "ios" }
    },

    "source-android" :
    {
      "extend" : ["source"],
      "let" : { "THEME" : "android" }
    },
    
    "source-indigo" :
    {
      "extend" : ["source"],
      "let" : { "THEME" : "indigo" }
    },
    
    "build-ios" :
    {
      "extend" : ["build"],
      "let" : { "THEME" : "ios" }
    },

    "build-android" :
    {
      "extend" : ["build"],
      "let" : { "THEME" : "android" }
    },
    
    "build-indigo" :
    {
      "extend" : ["build"],
      "let" : { "THEME" : "indigo" }
    },

    "source" :
    {
      "let" : { 
        "BUILD_PATH" : "${ROOT}/source"
      },
      "asset-let" : {
        "qx.mobile.platform" : [ "${THEME}" ]
      }
    },


    "build" :
    {
      "let" : { 
        "BUILD_PATH" : "${ROOT}/build-${THEME}" 
      },
      "asset-let" : {
        "qx.mobile.platform" : [ "${THEME}" ]
      },
      "=run" : ["build-resources", "build-files", "build-script", "minify-css"]
    },


    "source-script" :
    {
      "extend" : ["mobile-common"],
      "add-css" : [ 
        { "uri" : "../${QOOXDOO_PATH}/framework/source/resource/qx/mobile/css/${THEME}.css" },
        { "uri" : "./resource/${APPLICATION_CSS}" }
      ]
    },

    "build-script" :
    {
      "extend" : ["mobile-common"],
      //"add-css" : [ { "uri" : "${CSS_COMB_URI}" } ]
      "add-css" : [ 
        { "uri" : "./resource/qx/mobile/css/${THEME}.css" },
        { "uri" : "./resource/${APPLICATION_CSS}" }
      ]
    },

    "build-files" :
    {
      "copy-files" :
      {
        "files" :
        [
          "index.html"
        ],

        "source" : "${ROOT}/source/resource",
        "target" : "${BUILD_PATH}"
      }
    },


    "source-all-script" :
    {
      "extend" : ["mobile-common"],
      "=exclude" : 
      [
        "qx.test.*",
        "${APPLICATION}.test.*",
        "${APPLICATION}.simulation.*"
      ],
      "asset-let" : {
        "qx.mobile.platform" : [ "${THEME}" ]
      },
      "add-css" : [ 
        { "uri" : "../${QOOXDOO_PATH}/framework/source/resource/qx/mobile/css/${THEME}.css" },
        { "uri" : "./resource/${APPLICATION_CSS}" }
      ]
    },

    "minify-combine-css" :
    {
      "extend" : ["cache"],
      "let" :
      {
        "CATCMD"     : "${PYTHON_CMD} ${QOOXDOO_PATH}/tool/bin/cat.py",
        "CSSMIN_CMD" : "${PYTHON_CMD} ${QOOXDOO_PATH}/tool/bin/cssmin.py"
      },

      "shell" :
      {
        "command" :
        [
          "${CATCMD} ${QOOXDOO_PATH}/framework/source/resource/qx/mobile/css/${THEME}/${THEME}.css ${ROOT}/source/resource/${APPLICATION_CSS} | ${QOOXDOO_PATH}/tool/bin/cssmin.py > ${CSS_COMBINED}"
        ]
      }
    },

    "minify-css" :
    {
      "extend" : ["cache"],
      "let" :
      {
        "CATCMD"     : "${PYTHON_CMD} ${QOOXDOO_PATH}/tool/bin/cat.py",
        "CSSMIN_CMD" : "${PYTHON_CMD} ${QOOXDOO_PATH}/tool/bin/cssmin.py"
      },

      "shell" :
      {
        "command" :
        [
          "${CATCMD} ${ROOT}/source/resource/${APPLICATION_CSS} | ${CSSMIN_CMD} > ${BUILD_PATH}/resource/${APPLICATION_CSS}"
        ]
      }
    } 
  }
}
